//
//  SLLoanTermsComponent.m
//  SulitLoanDemo
//
//  Created by 虞嘉伟 on 2025/2/19.
//  
  

#import "SLLoanTermsComponent.h"
#import <YYKit.h>
#import <Masonry.h>


@interface SLLoanTermsComponent ()

@end

@implementation SLLoanTermsComponent

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = UIColorHex(#FFE0EF);
        self.layer.cornerRadius = 15;
        self.layer.borderColor = UIColorHex(#1B1B1B).CGColor;
        self.layer.borderWidth = 1.5;
        
        [self addSubview:self.titleLabel];
        [self addSubview:self.icon];
        
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(15);
            make.centerY.equalTo(self);
        }];
        [self.icon mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self);
            make.centerY.equalTo(self);
            make.width.mas_equalTo(89);
            make.height.mas_equalTo(73);
        }];
    }
    return self;
}
- (UIImageView *)icon {
    if (!_icon) {
        _icon = [UIImageView new];
        _icon.contentMode = UIViewContentModeScaleAspectFit;
        _icon.image = [UIImage imageNamed:@"icon_loan_terms"];
    }
    return _icon;
}
- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [UILabel new];
        _titleLabel.textColor = UIColorHex(#1B1B1B);
        _titleLabel.font = aspectDefaultFont(16);
        _titleLabel.text = @"Understand the loan terms";
    }
    return _titleLabel;
}
@end
